<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.fick.hibernate.dao.MediaclassDAO"%>
<%@page import="com.fick.hibernate.dao.MediaDAO"%>
<%@page import="com.fick.hibernate.model.Media"%>
<jsp:useBean id="pager" class="com.fick.util.Pager"></jsp:useBean>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>滑县公安信息网</title>
<link href="images/hxgaj.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%@include file="inc/head.jsp"%>
<!-- hxgaj -->
<table width="1003" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="left" valign="top"><table width="761" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="32" align="right" valign="middle" background="images/wzdh.gif"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="745" height="25" align="left" valign="middle" class="dhwz_wz3">视频列表</td>
            </tr>
        </table></td>
      </tr>
    </table>
    <table width="728" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td height="15"></td>
				</tr>
			</table>
    <%
    	MediaclassDAO mediaclassDAO = new MediaclassDAO();
            	MediaDAO mediaDAO = new MediaDAO();
            	int currPage=1;
            	//总数
            	int pagesize=9;
                int maxsize=((Integer)mediaDAO.getSession().createQuery("select count(mediaId) from com.fick.hibernate.model.Media where mediaStatus='1' ").iterate().next()).intValue();
                int maxpage=0;
                if(maxsize%pagesize == 0)
                {
                	maxpage = maxsize/pagesize;
                }
                else
                {
                	maxpage = maxsize/pagesize+1;
                }
                try
            	{
            		currPage = Integer.parseInt(request.getParameter("currPage"));
            		if(currPage<1||currPage>maxpage)
            		{
            	currPage=1;
            		}
            	}catch(NumberFormatException e)
            	{
            		currPage=1;
            	}
            	List listMedia=mediaDAO.findPage(currPage,pagesize,"where mediaStatus='1'  order by mediaOrder");
            	if(0==listMedia.size())
            	{
            		out.println("暂&nbsp;无&nbsp;内&nbsp;容");
            	}
            	else
            	{
    %>
		<table  width="740" border="0" cellspacing="0" cellpadding="0"><tr>
		
		<%
					for(int i=0;i<listMedia.size();i++)
						{
					if(0==i%3)
					{
						out.println("</tr><tr>");
					}
					Media media = (Media)listMedia.get(i);
				%>
			<td width="30%" align="center"  valign="middle">
				<a href="media_show.jsp?id=<%=media.getMediaId()%>" target="_blank"><img src="<%=media.getMediaIco()%>" width="200" height="150"/></a><br>
				<%=media.getMediaName() %>
			</td>
			<%
		}
		%>
		</tr></table>
		<%
    %>
    
    <%} %>
            <table width="705" border="0" cellspacing="0" cellpadding="0">
            	<tr>
            		<td class="p_list1_tiaoz">
					<%
						out.println(pager.nprintTable("media_list.jsp?siteid=1",currPage,maxpage,maxsize,"&",null));
			 	 	%>								
					</td>
				</tr>
			</table>	   
    </td>
    <td width="235" align="center" valign="top">
      </td>
</table>
<!-- hxgaj -->
<%@include file="inc/foot.jsp"%>
</body>
</html>